<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    const user = {
        name: 'zhangsan'
    }
    const user1 = {
        age: 18
    }
    const user2 = {
            sex: '男'
        }
        // user.age = user1.age;
        // user.sex = user2.sex;
        // console.log(user);
    let user3 = Object.assign(user, user1, user2);
    console.log(user3);

    const obj1 = {
        a: {
            b: 1
        }
    }
    const obj2 = {
        c: 1
    }
    const obj3 = Object.assign(obj2, obj1);
    obj1.a.b = 4;
    console.log(obj3);
</script>

</html>